package com.green.home.common.security.service;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import java.util.Arrays;
import java.util.List;

/**
 * 注册用户信息
 * @author limingliang
 * @date 2024/3/6 15:45
 */
public class UserDetailsServiceImpl implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        List<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(Arrays.asList("app", "web"));
        GreenUser greenUser = new GreenUser(username, "{noop}111111", authorities, 001L, "110");
        return greenUser;
    }
}
